//
//  CompanyJobModel.m
//  Btpin
//
//  Created by Vic on 2019/3/20.
//  Copyright © 2019 Vic. All rights reserved.
//

#import "CompanyJobModel.h"

@implementation CompanyJobModel

- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues {
    self.id = [UIToolsControl dataAnalysis:keyedValues[@"id"]];
    self.title = [UIToolsControl dataAnalysis:keyedValues[@"title"]];
    self.wage_cn = [UIToolsControl dataAnalysis:keyedValues[@"wage_cn"]];
    self.district = [UIToolsControl dataAnalysis:keyedValues[@"district"]];
    self.district_cn = [UIToolsControl dataAnalysis:keyedValues[@"district_cn"]];
    self.experience = [UIToolsControl dataAnalysis:keyedValues[@"experience"]];
    self.experience_cn = [UIToolsControl dataAnalysis:keyedValues[@"experience_cn"]];
    self.education = [UIToolsControl dataAnalysis:keyedValues[@"education"]];
    self.education_cn = [UIToolsControl dataAnalysis:keyedValues[@"education_cn"]];
    self.contents = [UIToolsControl dataAnalysis:keyedValues[@"contents"]];
    self.update_time = [UIToolsControl dataAnalysis:keyedValues[@"update_time"]];
    self.update_timeMMDD = self.update_time?[UIToolsControl timestampConversionTime:([self.update_time integerValue]) andFormat:@"MM月-dd日"]:@"";
    
    self.company_auth_medal = [UIToolsControl dataAnalysis:keyedValues[@"company_auth_medal"]];
    
    self.audit = [UIToolsControl dataAnalysis:keyedValues[@"audit"]];
    self.status = [UIToolsControl dataAnalysis:keyedValues[@"status"]];
    self.status_cn = [UIToolsControl dataAnalysis:keyedValues[@"status_cn"]];
    self.add_time = [UIToolsControl dataAnalysis:keyedValues[@"add_time"]];
    self.add_timeMMDD = self.add_time?[UIToolsControl timestampConversionTime:([self.add_time integerValue]) andFormat:@"MM月-dd日"]:@"";
    
    self.apply_status = [UIToolsControl dataAnalysis:keyedValues[@"apply_status"]];
    self.display = [UIToolsControl dataAnalysis:keyedValues[@"display"]];
    self.headhunter = [UIToolsControl dataAnalysis:keyedValues[@"headhunter"]];
    self.stick = [UIToolsControl dataAnalysis:keyedValues[@"stick"]];
    self.stick_time = [UIToolsControl dataAnalysis:keyedValues[@"stick_time"]];
    self.stick_timeMMDD = (self.stick_time && self.stick_time.length)?[UIToolsControl timestampConversionTime:([self.stick_time integerValue]) andFormat:@"MM月-dd日"]:@"";
    
    self.company_id = [UIToolsControl dataAnalysis:keyedValues[@"company_id"]];
    self.company_name = [UIToolsControl dataAnalysis:keyedValues[@"company_name"]];
    self.company_logo = [UIToolsControl dataAnalysis:keyedValues[@"company_logo"]];
    self.company_full_name = [UIToolsControl dataAnalysis:keyedValues[@"company_full_name"]];
    self.finance_cn = [UIToolsControl dataAnalysis:keyedValues[@"finance_cn"]];
    self.trade_cn = [UIToolsControl dataAnalysis:keyedValues[@"trade_cn"]];
    self.scale_cn = [UIToolsControl dataAnalysis:keyedValues[@"scale_cn"]];
    
    self.companyInfoModel = [[CompanyInfoModel alloc] init];
    if (keyedValues[@"company_info"]) {
        [self.companyInfoModel setValuesForKeysWithDictionary:keyedValues[@"company_info"]];
    }
    
    self.hrInfoModel = [[HRInfoModel alloc] init];
    if (keyedValues[@"hr_info"]) {
        [self.hrInfoModel setValuesForKeysWithDictionary:keyedValues[@"hr_info"]];
    }
    
    self.countInfoModel = [[CountInfoModel alloc] init];
    if (keyedValues[@"count_info"]) {
        [self.countInfoModel setValuesForKeysWithDictionary:keyedValues[@"count_info"]];
    }
    self.contentsHeight = 0;
    self.allHeight = 0;
    if (self.contents && self.contents.length) {
        NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
        [paragraphStyle setLineSpacing:LineSpacingHeight*2];
        NSInteger textHeight = ceil([self.contents boundingRectWithSize:CGSizeMake(WIDTH-30*Scale, MAXFLOAT) options:(NSStringDrawingUsesFontLeading|NSStringDrawingTruncatesLastVisibleLine|NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:Font(Font_13), NSParagraphStyleAttributeName:paragraphStyle} context:nil].size.height)+1;
        self.contentsHeight = textHeight;
        self.allHeight = 625*Scale+textHeight;
    } else {
        self.allHeight = 625*Scale;
    }
    
    self.job_id = [UIToolsControl dataAnalysis:keyedValues[@"job_id"]];
    self.job_title = [UIToolsControl dataAnalysis:keyedValues[@"job_title"]];
    self.job_status = [UIToolsControl dataAnalysis:keyedValues[@"job_status"]];
    self.job_update_time = [UIToolsControl dataAnalysis:keyedValues[@"job_update_time"]];
    self.job_update_timeMMdd = (self.job_update_time && self.job_update_time.length)?[UIToolsControl timestampConversionTime:([self.job_update_time integerValue]) andFormat:@"MM月-dd日"]:@"";
    
    self.category = [UIToolsControl dataAnalysis:keyedValues[@"category"]];
    self.category_cn = [UIToolsControl dataAnalysis:keyedValues[@"category_cn"]];
    self.nature = [UIToolsControl dataAnalysis:keyedValues[@"nature"]];
    self.nature_cn = [UIToolsControl dataAnalysis:keyedValues[@"nature_cn"]];
    self.age = [UIToolsControl dataAnalysis:keyedValues[@"age"]];
    self.sex = [UIToolsControl dataAnalysis:keyedValues[@"sex"]];
    self.sex_cn = [UIToolsControl dataAnalysis:keyedValues[@"sex_cn"]];
    self.minwage = [UIToolsControl dataAnalysis:keyedValues[@"minwage"]];
    self.maxwage = [UIToolsControl dataAnalysis:keyedValues[@"maxwage"]];
    
    self.favorite_status = [UIToolsControl dataAnalysis:keyedValues[@"favorite_status"]];
    
    self.promote_price = [UIToolsControl dataAnalysis:keyedValues[@"promote_price"]];
    self.promote_status = [UIToolsControl dataAnalysis:keyedValues[@"promote_status"]];
    
    self.share_promote = [UIToolsControl dataAnalysis:keyedValues[@"share_promote"]];
    self.share_promote_info = [[SharePromoteInfoModel alloc] init];
    if (keyedValues[@"share_promote_info"]) {
        [self.share_promote_info setValuesForKeysWithDictionary:keyedValues[@"share_promote_info"]];
    }
    self.share_promote_price = [UIToolsControl dataAnalysis:keyedValues[@"share_promote_price"]];
    self.share_promote_url = [UIToolsControl dataAnalysis:keyedValues[@"share_promote_url"]];
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
}
- (id)copyWithZone:(NSZone *)zone {
    CompanyJobModel *model = [[[self class] allocWithZone:zone] init];
    model.id = self.id;
    model.title = self.title;
    model.wage_cn = self.wage_cn;
    model.district_cn = self.district_cn;
    model.experience_cn = self.experience_cn;
    model.education_cn = self.education_cn;
    model.contents = self.contents;
    model.update_time = self.update_time;
    model.update_timeMMDD = self.update_timeMMDD;
    model.audit = self.audit;
    model.status = self.status;
    model.status_cn = self.status_cn;
    model.add_time = self.add_time;
    model.add_timeMMDD = self.add_timeMMDD;
    
    model.company_auth_medal = self.company_auth_medal;
    
    model.apply_status = self.apply_status;
    model.display = self.display;
    model.headhunter = self.headhunter;
    model.stick = self.stick;
    model.stick_time = self.stick_time;
    model.stick_timeMMDD = self.stick_timeMMDD;
    model.companyInfoModel = [self.companyInfoModel copy];
    model.hrInfoModel = [self.hrInfoModel copy];
    model.countInfoModel = [self.countInfoModel copy];
    
    model.company_id = self.company_id;;
    model.company_name = self.company_name;
    model.company_logo = self.company_logo;
    model.company_full_name = self.company_full_name;
    model.finance_cn = self.finance_cn;
    model.trade_cn = self.trade_cn;
    model.scale_cn = self.scale_cn;
    
    model.job_id = self.job_id;
    model.job_title = self.job_title;
    model.job_update_time = self.job_update_time;
    model.job_update_timeMMdd = self.job_update_timeMMdd;
    
    model.category = self.category;
    model.category_cn = self.category_cn;
    model.nature = self.nature;
    model.nature_cn = self.nature_cn;
    model.age = self.age;
    model.sex = self.sex;
    model.sex_cn = self.sex_cn;
    model.minwage = self.minwage;
    model.maxwage = self.maxwage;
    model.education = self.education;
    model.experience = self.experience;
    model.district = self.district;
    
    model.favorite_status = self.favorite_status;
    
    model.promote_price = self.promote_price;
    model.promote_status = self.promote_status;
    model.share_promote = self.share_promote;
    model.share_promote_info = [self.share_promote_info copy];
    
    return model;
}

@end
